package com.example.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

/**
 * @Author:帅帅的刘
 * @Description:
 * @Date:Create In 2019-09-18 11:30
 **/

@ControllerAdvice
public class ExceptionController {

    @ExceptionHandler(value = {java.lang.Exception.class})
    public String exceptionhandler(Exception e, Model model) {
         model.addAttribute("message",e.getMessage());
        return "error";
    }
}
